package com.feicheng.controller.wx;

import com.alibaba.fastjson.JSONObject;
import com.feicheng.common.result.ResultInfo;
import com.feicheng.persistence.entity.Aclientcz;
import com.feicheng.service.a.FXyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("/wx/client")
@RequestMapping("/wx/client")
public class XyController {

    @Autowired
    FXyService xyService;

    @PostMapping("/page")
    public ResultInfo getXyByPage(@RequestBody JSONObject param) {
        param = xyService.getXysByPage(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/tq/page")
    public ResultInfo getTqByPage(@RequestBody JSONObject param) {
        param = xyService.getTqBypage(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/tq/info")
    public ResultInfo newTq(@RequestBody JSONObject param) {
        param = xyService.newTq(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/yj/in")
    public ResultInfo inYj(@RequestBody JSONObject param) {
        param = xyService.yjin(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/yj/out")
    public ResultInfo outYj(@RequestBody JSONObject param) {
        param = xyService.yjout(param);
        return ResultInfo.success();
    }

    @PostMapping("/info/put")
    public ResultInfo updateClient(@RequestBody JSONObject param) {
        param = xyService.updateXy(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/info/get")
    public ResultInfo getClient(@RequestBody JSONObject param) {
        return ResultInfo.success(xyService.getXy(param));
    }

    @PostMapping("/cz/info")
    public ResultInfo newCz(@RequestBody Aclientcz aclientcz) {

        JSONObject param = new JSONObject();
        param.put("aclientcz", aclientcz);

        param = xyService.newCz(param);

        return ResultInfo.success(param);
    }

    @PostMapping("/hyjl/page")
    public ResultInfo getHyjlByPage(@RequestBody JSONObject param) {
        param = xyService.getHysByPage(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/hyjl/get")
    public ResultInfo getHyjl(@RequestBody JSONObject param) {
        param = xyService.getHyjl(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/bm/page")
    public ResultInfo getBmByPage(@RequestBody JSONObject param) {
        param = xyService.getBmByPage(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/cz/page")
    public ResultInfo getCzByPage(@RequestBody JSONObject param) {
        param = xyService.getCzByPage(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/bm/info/get")
    public ResultInfo getBm(@RequestBody JSONObject param) {
        param = xyService.getBm(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/bm/info/post")
    public ResultInfo newBm(@RequestBody JSONObject param) {
        param = xyService.bm(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/zybm/info/post")
    public ResultInfo newzyBm(@RequestBody JSONObject param) {
        param = xyService.zybm(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/bm/info/put")
    public ResultInfo cancelBm(@RequestBody JSONObject param) {
        param = xyService.cancelBm(param);
        return ResultInfo.success(param);
    }

    @PostMapping("/hy/info")
    public ResultInfo newHy(@RequestBody JSONObject param) {
        param = xyService.newHy(param);
        return ResultInfo.success(param);
    }

    /**
     * jinjingyi 会员详细查询
     */
    @PostMapping("/hyjl/info/get")
    public ResultInfo getHyjlInfo(@RequestBody JSONObject param) {
        param = xyService.getHyjl(param);
        return ResultInfo.success(param);
    }

    /**
     * jinjingyi 会员退款查询
     */
    @PostMapping("/hyjl/refund")
    public ResultInfo goRefund(@RequestBody JSONObject param) {
        param = xyService.hyRefund(param);
        return ResultInfo.success(param);
    }

    @PostMapping ("/fxjl/page")
    public ResultInfo getFxjlByPage(@RequestBody JSONObject param) {
        param = xyService.getFxjlByPage(param);
        return ResultInfo.success(param);
    }

    @PostMapping ("/fxjl/list")
    public ResultInfo getFxjlByList(@RequestBody JSONObject param) {
        param = xyService.getFxjlByList(param);
        return ResultInfo.success(param);
    }
}
